package name.swingeet.swingElf;

import java.rmi.Remote;

import org.netbeans.jemmy.operators.ContainerOperator;

public interface SwingTestInterface extends Remote{

	public void ReferenceApp(String clazz) throws Exception;

	public String SystemOutPrintTest(String text) throws Exception;
	public boolean isCheckBoxEnabled(String mainWindow, Object object) throws Exception;
	public void setTextInFieldOperator(String mainWindow,
			 int indexNum,String value)throws Exception;
	/**
	 * This method is designed to push a button and for a dialog window to be opened.
	 * The method also activates a retry mechanism until the dialog is successfully opened.
	 * 
	 * @param windowName
	 *            The window the button exist in (Label of the window)
	 * @param buttonName
	 *            The button name to push
	 * @param mainWindow
	 *            The dialog window that will be opened.
	 * @throws Exception
	 */

	public void pushButtonAndWaitForDialog(String mainWindow,
			String buttonName, String windowName) throws Exception;

	public void pushButtonAndWaitAndApproveDialog(String mainWindow,
			String buttonName, String windowName, String dialogButton)
			throws Exception;

	/**
	 * locate a component by name, inside a given container
	 * 
	 * @param mainWindow
	 *            the container to look inside
	 * @param text
	 *            the text to find
	 * @return
	 */

	public boolean isComponentDisplayed(String windowName, String text)
			throws Exception;

	/**
	 * close a dialog window if opened
	 * 
	 * @param dialogName
	 *            the dialog window title
	 * @param confirmButton
	 *            the confirm button text
	 * @return true if a dialog was opened, false if none opened
	 * @throws Exception
	 */

	public boolean ConfirmDialogIfExists(String dialogName, String confirmButton)
			throws Exception;

	/**
	 * Return state of a button identified by a String\Index
	 * 
	 * @param mainWindow
	 *            the operator the button is inside
	 * @param identifier
	 *            the name\Index of the button
	 * @return isEnabled return false if disabled
	 * @throws Exception
	 */

	public Boolean isButtonEnabled(String windowName, Object identifier)
			throws Exception;

	/**
	 * select a given value in a combobox operator
	 * 
	 * @param mainWindow
	 *            the operator to search the combobox in
	 * @param txt
	 *            the combobox title
	 * @param value
	 *            the value to set
	 */

	public void selectInComboBox(String windowName, String txt, Object value)
			throws Exception;

	/**
	 * select a given value in a combobox operator
	 * 
	 * @param mainWindow
	 *            the operator to search the combobox in
	 * @param txt
	 *            the combobox title
	 * @param value
	 *            the value to set
	 * @param indexNum
	 *            how many operators to skip
	 */

	public void selectInComboBox(String windowName, String txt, Object value,
			int indexNum) throws Exception;

	/**
	 * checks if the dialog exists. if found, check if it is still visible in 1
	 * second intervals
	 * 
	 * @param dialogTitle
	 *            the dialog title
	 * @throws Exception
	 */

	public void WaitForDialogToClose(String dialogTitle) throws Exception;

	/**
	 * locate a radio button by a given identifier (name\index)
	 * 
	 * @param mainWindow
	 *            the operator to search in
	 * @param identifier
	 *            the name\index to locate radioButton by
	 */

	public void pushRadioButton(String windowName, Object identifier)
			throws Exception;

	/**
	 * set a text in a JTextField operator
	 * 
	 * @param mainWindow
	 *            the container to search in
	 * @param labelText
	 *            the label before the JTextField
	 * @param value
	 *            the value to insert
	 * @param indexNum
	 *            how many JTextFields to skip
	 */

	public void setTextInFieldOperator(String windowName, String labelText,
			Object value, int indexNum) throws Exception;

	/**
	 * set a text in the first JTextField operator found after the given label
	 * 
	 * @param mainWindow
	 *            the container to search in
	 * @param labelText
	 *            the label before the JTextField
	 * @param value
	 *            the value to insert
	 */

	public void setTextInFieldOperator(String windowName, String labelText,
			Object value) throws Exception;

	/**
	 * set a text in a JTextArea operator
	 * 
	 * @param mainWindow
	 *            the container to search in
	 * @param labelText
	 *            the label before the JTextField
	 * @param value
	 *            the value to insert
	 * @param indexNum
	 *            how many JTextArea to skip
	 */

	public void setTextInAreaOperator(String windowName, String labelText,
			Object value, int indexNum) throws Exception;

	/**
	 * set a text in the first JTextArea operator found after the given label
	 * 
	 * @param mainWindow
	 *            the container to search in
	 * @param labelText
	 *            the label before the JTextArea
	 * @param value
	 *            the value to insert
	 */

	public void setTextInAreaOperator(String windowName, String labelText,
			Object value) throws Exception;

	public boolean isCheckBoxDisplayed(String windowName,String obj)throws Exception;
	public boolean pushButton(String windowName,Object obj, int notTry)throws Exception;
	public void pushButton(String windowName, String buttonText)
			throws Exception;

	/**
	 * This method sets checkbox condition to on or off.
	 * The method also activates a retry mechanism until successful
	 * 
	 * @param condition
	 *            true to set it on , false to set it to off
	 * @param windowName
	 *            The window name the checkbox exist in
	 * @param checkBoxName
	 *            The number of the checkbox in the window.
	 * @throws Exception
	 */
	public void setCheckBox(String windowName, int checkBoxNumber,
			boolean condition) throws Exception;

	/**
	 * check/uncheck a checkbox
	 * 
	 * @param mainWindow
	 *            the oprrator the checkbox is inside
	 * @param identifier
	 *            checkbox name\index
	 * @param enable
	 *            True will check, False will uncheck
	 */
	public void setCheckBox(String windowName, String checkBoxName,
			boolean enable) throws Exception;

}